<template>
  <page-meta :root-font-size="setting.rootFontSize"></page-meta>
  <view>
    <view style="flex: 1; overflow: auto">
      <!-- <th-card title="任务单信息"> -->
      <th-form>
        <view class="blocks" v-for="(item, index) in reviewPostList" :key="index">
          <view class="label">{{ item.documentsPostName }}</view>
          <view class="row" @click="showSelectUser(item, index)">
            <template v-if="state[item.documentsPostCode] && state[item.documentsPostCode].length">
              <wd-tag
                style="
                  padding: 5rpx 10rpx;
                  font-size: 26rpx;
                  border-radius: 6rpx;
                  margin-right: 12rpx;
                  margin-bottom: 10rpx;
                "
                v-for="ite in state[item.documentsPostCode]"
                :key="ite.value"
                type="primary"
              >
                {{ ite.personName }}
              </wd-tag>
            </template>
            <template v-else>
              <view style="color: #666; font-size: 14px">
                {{ '请选择' + item.documentsPostName }}
              </view>
              <!-- <input
                type="text"
                :readonly="true"
                v-model="state[item.documentsPostCode]"
                :placeholder="'请选择' + item.documentsPostName"
              /> -->
            </template>
          </view>
        </view>
        <th-form-item label="预计完成日期" class="form-demandDesc">
          <uni-datetime-picker
            style="font-size: 14px"
            type="date"
            return-type="string"
            :border="false"
            v-model="state.userTime"
            placeholder="预计完成日期"
          />
        </th-form-item>
        <th-form-item label="说明" class="form-demandDesc">
          <wd-textarea
            v-model="state.reason"
            style="border: 1px solid #f7f7f7; flex: 1; width: 100%; font-size: 14px"
          ></wd-textarea>
        </th-form-item>
      </th-form>
      <!-- </th-card> -->
    </view>
    <view class="flow-btn-fixed">
      <view class="btn_group" style="width: 100%">
        <view class="btn primary" @click="submit">保存</view>
      </view>
    </view>
    <!--       :deptId="deptId" -->
    <leaguerPickerPm
      :show="selectUserShow"
      :filtration="true"
      :checked="state[currentType]"
      :nop="100"
      :from="from"
      :returnDeptName="true"
      @hideModal="hideModal"
      @checkLeaguer="checkLeaguer"
    ></leaguerPickerPm>
  </view>
</template>

<script lang="ts" setup>
import { useSetting } from '@/stores/setting';
import { getObj, getPersonByPersonCode, updateByIdEvery, uploadSignature } from '@/service/pm-task';
import { formatByDayjs } from '@/utils/util';
import { useUserStore } from '@/stores/user';
import {
  selectrdDocumentsPostUser,
  selectrdDocumentsPostDict,
  updateSignHandle,
  getRdProjectUser,
  updateProjectUsers,
} from '@/service/pm-requirement';
const showTaskPop = () => {};
const props = defineProps({
  id: {
    type: String,
    default: '',
  },
});
const emit = defineEmits(['refreshDetail']);
const setting = useSetting();
const userStore = useUserStore();
const showSign = ref(false);
const signature = ref('');
const userInfo = ref({});
const isChiefEngineer = ref('');
const isDeputyChiefEngineer = ref('');
const showAction = ref(false);
const postUserObj: any = ref({});
const rdProjectUserList = ref([]); // 签名列表
const currentIndex = ref([0]);
// const deptId = ref('1805434119908089858');
// 提交表单数据
const form = reactive({
  id: null,
  demandDate: null,
  personName: null,
  demandType: null,
  deptHead: null,
  deptCode: null,
  applicationType: null,
  samplesNum: null,
  demandDesc: null,
  sampleCoding: null,
  askCompleteTime: null,
  taskCode: null,
  userCode: null,
  invName: null,
  invDemand: null,
  sampleFlag: null,
  demandCode: null,
  cusName: null,
  personCode: null,
  deptHeadCode: null,
  cusFlag: '0',
  demandResult: null,
  completeTime: null,
  // technologyHead: null,
  remark: null,
  // technologyHeadCode: null,
  taskId: null,
  instanceId: null,
  invStd: null,
  sampleCode: null,
  sampleBatch: null,
  deptName: null,
  rdFlag: null,
  chiefEngineer: null,
  deputyChiefEngineer: null,
  status: null,
  sampleFlagName: null,
  deputyChiefEngineerUrl: null,
  chiefEngineerUrl: null,
  sampleUnit: null,
  cusCode: null,
  projectCode: null,
  projectName: null,
  rdProjectUser: null,
  projectHead: null,
  completionTime: null,
  // technologyHeadName: null,
  rdInformationDTO: [],
  rdCraftEntity: [],
  rdSampleAnalysisEntity: [],
  rdPlan: null,
  sampleReviewConclusion: null,
  requirements: null,
  projectHeadName: null,
  signedName: null,
  rdProjectUserEntity: [],
});
let from = ref('');
// const from = computed(() => {
//   return form.taskType == 9 ? '' : 'taskPerson';
// });
const loading = ref(false);
const init = (params) => {
  // try {
  //   getUserList({
  //     id: params.id,
  //     taskCode: params.taskCode,
  //     demandCode: params.demandCode,
  //   });
  // } catch (error) {}
  from.value = 'taskPerson';
  uni.$off('pm-requirement-sign');
  // selectrdDocumentsPostDictList();
  selectrdDocumentsPostDictLists();
  // getUserList(params);
  uni.showLoading({ mask: true });
  loading.value = true;
  getObj(params)
    .then((res) => {
      console.log('res', res);
      // Object.assign(form, res.data);
      delPerson.value = [];
      try {
        for (const key in res.data) {
          if (Object.prototype.hasOwnProperty.call(res.data, key)) {
            const element = res.data[key];
            form[key] = element;
          }
        }
        // if (form.taskType == 9) {
        //   deptId.value = '';
        // }
        const rdDemandEntity = res.data.rdDemandEntity;
        if (rdDemandEntity) {
          const o: any = {};
          o.demandDate = rdDemandEntity.demandDate ? formatByDayjs(rdDemandEntity.demandDate) : '';
          o.askCompleteTime = rdDemandEntity.askCompleteTime
            ? formatByDayjs(rdDemandEntity.askCompleteTime)
            : '';
          o.demandCode = rdDemandEntity.demandCode;
          o.cusCode = rdDemandEntity.cusCode;
          o.deptName = rdDemandEntity.deptName;
          o.demandType = rdDemandEntity.demandType;
          o.deptCode = rdDemandEntity.deptCode;
          o.invName = rdDemandEntity.invName;
          o.invStd = rdDemandEntity.invStd;
          o.applicationType = rdDemandEntity.applicationType;
          o.invDemand = rdDemandEntity.invDemand;
          o.sampleFlagName = rdDemandEntity.sampleFlagName;
          o.sampleCode = rdDemandEntity.sampleCode;
          o.samplesNum = rdDemandEntity.samplesNum;
          o.sampleUnit = rdDemandEntity.sampleUnit;
          o.sampleBatch = rdDemandEntity.sampleBatch;
          // o.askCompleteTime = rdDemandEntity.askCompleteTime;
          o.demandDesc = rdDemandEntity.demandDesc;
          o.cusFlag = rdDemandEntity.cusFlag;
          o.sampleFlag = rdDemandEntity.sampleFlag;
          o.personName = rdDemandEntity.personName;

          Object.assign(form, o);
        }

        // analysisList.value = res.data.rdSampleAnalysisEntity;
        // const rdProject = [];
        const rdProject = [];
        res.data.rdProjectUserEntity.forEach((item: any) => {
          rdProject.push(item.userName);
        });
        form.rdProjectUser = rdProject.join(',');

        let rdInformationDTO = res.data.rdInformationDTO;
        rdInformationDTO = rdInformationDTO.map((item) => {
          const l = item.rdInformationProfileEntity;
          const rdInformationProfileEntity = [];
          l.forEach((rd) => {
            const profileType = rd.profileType;
            if (profileType == 'web') {
              item.informationWeb = rd.profileUrl;
            } else {
              rdInformationProfileEntity.push(rd);
            }
          });

          return {
            ...item,
            rdInformationProfileEntity: rdInformationProfileEntity,
          };
        });
        const rdProjectUserEntity = form.rdProjectUserEntity;
        const lpost = [0, 2];
        lpost.forEach((l) => {
          const projectUser0 = rdProjectUserEntity.filter((item) => item.userType == l);
          state.value[l] = projectUser0.map((item) => {
            return {
              ...item,
              personId: item.personId,
              userName: item.userName,
              userCode: item.userCode,
              personName: item.userName,
              personCode: item.userCode,
            };
          });
        });
        oldrdProjectUserEntity.value = rdProjectUserEntity.map((item) => {
          return {
            ...item,
            oldUserName: item.userName,
            oldUserCode: item.userCode,
          };
        });
        if (form.rdProjectUserEntity && form.rdProjectUserEntity.length) {
          const lu = form.rdProjectUserEntity.filter((item) => item.userTime);
          state.value.userTime =
            (lu && lu.length && lu[0]['userTime']) ||
            formatByDayjs(new Date(), 'YYYY-MM-DD HH:mm:ss');
        }
        form.rdInformationDTO = rdInformationDTO;
        loading.value = false;
      } catch (error) {
        loading.value = false;
      }
    })
    .catch(() => {
      loading.value = false;
    })
    .finally(() => {
      uni.stopPullDownRefresh();
      uni.hideLoading();
    });
  // checkPost();
  selectrdDocumentsPostUserFn();
};
const oldrdProjectUserEntity = ref([]);
const getUserList = (row) => {
  getRdProjectUser({
    demandCode: row.demandCode,
    rdCode: row.demandCode,
    // rdId: row.id,
    size: 1000,
  }).then((res) => {
    if (res.code === 0) {
      // Object.assign(form, res.data);
      // reviewPostList.value.filter((item) => item.chooseFlag == 1 && item.mainFlag != 1);
      const ll = res.data.records;

      const rdProjectUserEntity = [];
      ll.forEach((item) => {
        if (reviewPostList.value.find((r) => r.documentsPostCode == item.documentsPostCode)) {
          rdProjectUserEntity.push(item);
        }
      });

      const rdl = rdProjectUserEntity; // 获取所有选择的人员
      const lpost = [];
      rdl.forEach((item) => {
        if (!lpost.find((l) => l == item.documentsPostCode)) {
          lpost.push(item.documentsPostCode);
        }
      });

      lpost.forEach((l) => {
        const projectUser0 = rdProjectUserEntity.filter((item) => item.documentsPostCode == l);
        state.value[l] = projectUser0.map((item) => {
          return {
            personId: item.personId,
            userName: item.userName,
            userCode: item.userCode,
            personName: item.userName,
            personCode: item.userCode,
          };
        });
      });

      form.rdProjectUserEntity = rdProjectUserEntity.map((item) => {
        return {
          ...item,
          oldUserName: item.userName,
          oldUserCode: item.userCode,
        };
      });
      oldrdProjectUserEntity.value = rdProjectUserEntity.map((item) => {
        return {
          ...item,
          oldUserName: item.userName,
          oldUserCode: item.userCode,
        };
      });
      console.log(oldrdProjectUserEntity, 'oldrdProjectUserEntity');

      if (form.rdProjectUserEntity && form.rdProjectUserEntity.length) {
        const lu = form.rdProjectUserEntity.filter((item) => item.userTime);
        state.value.userTime =
          (lu && lu.length && lu[0]['userTime']) ||
          formatByDayjs(new Date(), 'YYYY-MM-DD HH:mm:ss');
      }

      // state.value.reason = form.reason;
      console.log(form.rdProjectUserEntity, 'form.rdProjectUserEntity', oldrdProjectUserEntity);
    } else {
      uni.showToast({
        title: `${res.msg}`,
        icon: 'none',
      });
    }
  });
};
// onMounted((options) => {
//   const params = options.params;
//   const obj = JSON.parse(params);

//   init({
//     id: obj.id,
//     taskCode: obj.taskCode,
//     demandCode: obj.demandCode,
//   });
// });
// onLoad((options) => {
//   const params = options.params;
//   const obj = JSON.parse(params);

//   init({
//     id: obj.id,
//     taskCode: obj.taskCode,
//     demandCode: obj.demandCode,
//   });
//   getUserList({
//     id: obj.id,
//     taskCode: obj.taskCode,
//     demandCode: obj.demandCode,
//   });
// });

const selectUserShow = ref(false);
const selectList = ref({});
const filterIsShow = ref(false);
const state = ref({});
const hideModal = () => {
  selectUserShow.value = false;
};
const currentType = ref('');
const currentList = ref('');
const current = ref({});
const showSelectUser = (item, index) => {
  console.log(item, 12321311111111111111111);
  currentType.value = item.documentsPostCode;
  current.value = item;
  // currentList.value = item.documentsPost;
  currentIndex.value = index;
  selectUserShow.value = true;
};
const handleClose = () => {
  filterIsShow.value = false;
};
onPullDownRefresh(() => {
  init({
    id: form.id,
    taskCode: form.taskCode,
    demandCode: form.demandCode,
  });
});

const goBack = () => {
  uni.navigateBack();
};

const preview = (url) => {
  if (!url) return;
  uni.previewImage({
    urls: [url],
  });
};

const closeSign = () => {
  showAction.value = false;
  uni.$off('pm-requirement-sign');
};

const signHanle = (sign) => {
  const userInfos: any = userInfo.value;
  // // 判断岗位
  // const _isChiefEngineer = isChiefEngineer.value;
  // const _isDeputyChiefEngineer = isDeputyChiefEngineer.value;

  // const params = {
  //   id: form.id,
  // };

  // if (!_isChiefEngineer && !_isDeputyChiefEngineer) {
  //   uni.showToast({
  //     title: '只有总工和副总工才能签字',
  //     icon: 'none',
  //   });
  //   return;
  // }

  // if (_isChiefEngineer) {
  //   // params['chiefEngineer'] = userInfos.id;
  //   params['chiefEngineer'] = userInfos.personCode;
  //   params['chiefEngineerName'] = userInfos.personName;
  //   params['chiefEngineerPost'] = _isChiefEngineer;
  //   params['chiefEngineerUrl'] = sign;
  // } else if (_isDeputyChiefEngineer) {
  //   params['deputyChiefEngineer'] = userInfos.personCode;
  //   params['deputyChiefEngineerName'] = userInfos.personName;
  //   params['deputyChiefEngineerPost'] = _isDeputyChiefEngineer;
  //   params['deputyChiefEngineerUrl'] = sign;
  // }

  console.log('postUserObj', postUserObj.value);
  const params = {
    demandCode: form.demandCode,
    taskCode: form.taskCode,
    personId: userInfos.id,
    userName: userInfos.personName,
    userCode: userInfos.personCode,
    userUrl: sign,
    // userType: postUserObj.value.documentsPostCode,
    documentsPostName: postUserObj.value.documentsPostName,
    documentsPostCode: postUserObj.value.documentsPostCode,
    documentsName: postUserObj.value.documentsName,
    documentsCode: postUserObj.value.documentsCode,
    signatureFlag: postUserObj.value.signatureFlag,
    reviewFlag: postUserObj.value.reviewFlag,
    rdCode: form.taskCode,
  };

  uni.showLoading({
    mask: true,
  });

  updateSignHandle(params)
    .then((res) => {
      if (res.code == 0) {
        uni.showToast({
          title: '签字成功',
        });

        // setTimeout(() => {
        //   uni.navigateBack();
        // }, 500);

        // 更新签字
        if (!signature.value) {
          uploadSignature({
            id: userInfos.id,
            signature: sign,
          });
        }
        showAction.value = false;
        // 刷新页面
        init({
          id: form.id,
          taskCode: form.taskCode,
          demandCode: form.demandCode,
        });
      } else {
        uni.showToast({
          mask: true,
          title: `签字失败,原因${res.msg}`,
          icon: 'none',
        });
      }
    })
    .finally(() => {
      uni.hideLoading();
      // uni.$off('pm-requirement-sign');
    });
};

const signThis = () => {
  const sign = signature.value;
  signHanle(sign);
};

const signReset = () => {
  uni.$on('pm-requirement-sign', (e) => {
    console.log('sign', e);
    signHanle(e);
  });
  uni.navigateTo({
    url: '/pages/pm/requirement/autograph',
  });
};

const previewImg = (url) => {
  if (!url) return;
  const urls = [];
  urls.push(url);
  console.log('url', urls);
  uni.previewImage({
    urls: urls,
    fail: (fail) => {
      console.log('fail', fail);
    },
  });
};

const previewFileHandle = (file) => {
  uni.navigateTo({
    url: '/pages/pm/preview-online?url=' + file,
  });
};

const previewWeb = (url) => {
  uni.navigateTo({
    url: '/pages/pm/preview-online?url=' + url + '&isWeb=1',
  });
};

const selectrdDocumentsPostDictList = async () => {
  try {
    const res = await selectrdDocumentsPostDict({
      webSql: `documents_code = '2'`,
      size: 1000,
    });
    if (res.code !== 0) {
      return;
    }
    console.log(res.data, 'rea.datataaaaaaaaa');

    rdProjectUserList.value = res.data.records;
  } catch (err) {
    console.log('err', err);
  }
};

const selectrdDocumentsPostUserFn = () => {
  const userInfos = userStore.userInfos;
  const cusPerson = userInfos.user.username;

  selectrdDocumentsPostUser({
    webSql: `user_code = '${cusPerson}' and documents_code = 2`,
    size: 1000,
  })
    .then((res) => {
      if (res.code == 0) {
        if (res.data.records.length) {
          const lrs = res.data.records.find(
            (item) => item.reviewFlag == 1 && item.signatureFlag == 1,
          );
          const lr = res.data.records.find((item) => item.reviewFlag == 1);
          const l = res.data.records;
          let o: any = {};

          if (lrs.length) {
            o = lrs[0];
          } else if (lr.length) {
            o = lr[0];
          } else {
            o = l[0];
          }
          postUserObj.value = o;
          if (o.reviewFlag == 1 || o.signatureFlag == 1) {
            showSign.value = true;
          } else {
            showSign.value = false;
          }
        } else {
          showSign.value = false;
        }
      } else {
        showSign.value = false;
      }
    })
    .catch(() => {
      showSign.value = false;
    });
};

// type 0 获取姓名 1 获取签名
const getProjectName = (item, type = 0) => {
  console.log(form.rdProjectUserEntity, item);
  const l = form.rdProjectUserEntity.filter((f) => f.userType == item.documentsPostCode);
  let s = '';
  if (l.length) {
    console.log('s', s);
    if (type == 0) {
      s = l.map((item) => item.userName).join(',');
      return s;
    } else {
      // s = l.map((item) => item.userUrl).join(',');
      s = l[0]['userUrl'];
      return s;
    }
  } else {
    return s;
  }
};

const reviewPostList = ref([]);

const selectrdDocumentsPostDictLists = async () => {
  try {
    const res = await selectrdDocumentsPostDict({
      webSql: `documents_code = '2'`,
      size: 1000,
    });
    if (res.code !== 0) {
      return;
    }
    reviewPostList.value = res.data.records.filter(
      (item) => item.chooseFlag == 1 && item.documentsPostCode != '123' && item.mainFlag == 0,
    );
    reviewPostList.value.forEach((item) => {
      if (!state.value[item.documentsPostCode]) {
        state.value[item.documentsPostCode] = [];
      }
      if (!state.value[item.documentsPost]) {
        state.value[item.documentsPost] = [];
      }
    });
  } catch (err) {
    // notification.error({
    //   message: '提示',
    //   // description: err.msg,
    //   description: err.msg || err.message || '获取字典列表失败',
    //   placement: 'bottomRight',
    // });
  }
};
const delPerson = ref([]);
const checkLeaguer = (e) => {
  if (e) {
    state.value[currentType.value] = e.map((item) => {
      return {
        personId: item.id || item.personId,
        userName: item.personName,
        userCode: item.personCode,
        personName: item.personName,
        personCode: item.personCode,
      };
    });

    const rdProjectUserEntityList = [];
    e.filter((item) => !!item).forEach((item) => {
      // const o = defaultrdProjectUserList.value.find((i) => i.personId == item.id && i.documentsPostCode == row.documentsPostCode);
      rdProjectUserEntityList.push({
        // ...item,
        personId: item.personId || item.id,
        userName: item.personName || item.userName,
        userCode: item.personCode || item.userCode,
        userType: currentType.value,
        documentsName: current.value.documentsName,
        documentsCode: current.value.documentsCode,
        documentsId: current.value.documentsId,
        documentsPostCode: current.value.documentsPostCode,
        documentsPostName: current.value.documentsPostName,
        processCode: 2,
        // reviewFlag: o ? o.reviewFlag : row.reviewFlag,
        // signatureFlag: o ? o.signatureFlag : row.signatureFlag,
        reviewFlag: current.value.reviewFlag,
        signatureFlag: current.value.signatureFlag,
        chooseFlag: current.value.chooseFlag,
        updateType: '新增',
        value: item.personCode,
        label: item.personName,
        personName: item.personName || item.userName,
        personCode: item.personCode || item.userCode,
      });
    });

    if (e.length == 0) {
      form.rdProjectUserEntity = form.rdProjectUserEntity.filter(
        (item) => item.documentsPostCode != current.value.documentsPostCode,
      );
    }

    form.rdProjectUserEntity = form.rdProjectUserEntity
      .filter((f) => f.documentsPostCode == 0 || f.documentsPostCode == 2)
      .filter((f) => f.userType != current.value.documentsPostCode)
      .concat(rdProjectUserEntityList);

    if (oldrdProjectUserEntity.value) {
      oldrdProjectUserEntity.value
        .filter((item) => item.userType == current.value.documentsPostCode)
        .forEach((item, index) => {
          const i = form.rdProjectUserEntity.findIndex(
            (oi) => oi.userType == current.value.documentsPostCode && oi.personId == item.personId,
          );
          if (i < 0) {
            form.rdProjectUserEntity.push({
              ...item,
              delFlag: 1,
              updateType: '删除',
            });
          } else {
            form.rdProjectUserEntity[i] = item;
          }
        });
    }
  } else {
    // form.rdProjectUserEntity = [];
    form.rdProjectUserEntity = form.rdProjectUserEntity
      .filter((f) => f.documentsPostCode == 0 || f.documentsPostCode == 2)
      .map((item) => {
        if (item.userType == current.value.documentsPostCode) {
          return {
            ...item,
            delFlag: 1,
          };
        } else {
          return {
            ...item,
          };
        }
      });
  }
};
const submit = () => {
  // if (delPerson.value.length) {
  //   //  form.rdProjectUserEntity.concat(delPerson.value)
  //   form.rdProjectUserEntity = [...form.rdProjectUserEntity, ...delPerson.value];
  // }
  if (!state.value.userTime) {
    uni.showToast({
      title: '请选择预计完成日期',
      icon: 'none',
    });
    return;
  }

  const params = form.rdProjectUserEntity
    .filter((f) => f.documentsPostCode == 0 || f.documentsPostCode == 2)
    .map((item) => {
      return {
        ...item,
        // id: form.id,
        demandCode: form.demandCode,
        userTime:
          state.value.userTime.length > 11
            ? state.value.userTime
            : state.value.userTime + ' 00:00:00',
        reason: state.value.reason,
        rdCode: form.taskCode,
        rdId: form.id,
      };
    });

  if (loading.value == true) return;
  loading.value = true;
  updateProjectUsers(params)
    .then((res) => {
      console.log(res, 112);

      if (res.code === 0) {
        uni.showToast({
          title: `保存成功`,
          icon: 'none',
        });
        uni.$emit('refreshList');
        emit('refreshDetail');
        setTimeout(() => {
          loading.value = false;
        }, 1000);

        // emit('getData');
      } else {
        uni.showToast({
          title: res.msg,
          icon: 'none',
        });
      }
    })
    .catch((err) => {
      loading.value = false;
      uni.showToast({
        title: err,
        icon: 'none',
      });
    })
    .finally(() => {});
};
defineExpose({
  init,
});
</script>

<style lang="scss" scoped>
.block .content {
  padding: 0 !important;
}

.card-detail {
  padding: 0 !important;
}

.wd-cell {
  padding-left: 0 !important;
}

.wd-card__title {
  border-left: 4px solid #2e5cf6 !important;
}

.pm-table {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0 30rpx;

  .pm-title {
    box-sizing: border-box;
    padding-left: 20rpx;
    margin: 40rpx 0;
    font-size: 32rpx;
    font-weight: bold;
    color: #333;
    border-left: 8rpx solid #2e5cf6;
    border-radius: 4rpx;
  }

  .pm-row {
    display: flex;
    min-height: 60rpx;
    border-bottom: 1px solid #f6f0f0;

    .pm-label {
      display: flex;
      align-items: center;
      width: 20%;
      font-size: 26rpx;
      color: #979494;
    }

    .pm-value {
      display: flex;
      flex: 1;
      align-items: center;
      font-size: 26rpx;
      color: #333;
    }
  }
}

.sign-main {
  // display: flex;
  // align-items: center;
  // justify-content: center;
  // width: 100%;
  // margin: 20rpx 0;
  position: fixed;
  right: 0rpx;
  bottom: 40rpx;
  width: 160rpx;
  height: 80rpx;
  line-height: 80rpx;
  color: white;
  text-align: center;
  background-color: rgb(77 128 240);

  // border-radius: 50%;
  border-top-left-radius: 40rpx;
  border-bottom-left-radius: 40rpx;
}

:deep(.label) {
  width: 160rpx !important;
}

.result-tag {
  padding: 6rpx 14rpx;
  margin: 2rpx 0;
  font-size: 24rpx;
  color: white;
  background-color: #87d068;
  border-radius: 4rpx;
}

.sign-main-show {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  .sign-main-show-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 80rpx;
    margin-bottom: 20rpx;
    font-size: 30rpx;
    font-weight: bold;
    color: #818181;
    border-bottom: 1px solid #e3e3e3;
  }

  .sign-main-show-line {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90%;
    padding: 20rpx;
    margin: 20rpx 0;
    border: 4rpx solid #d0dbff;
    border-radius: 10rpx;
  }

  .sign-main-show-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 80rpx;
    border-top: 1px solid #e3e3e3;
  }
}

.info-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.info-list-main {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10rpx;
  margin: 10rpx 0;
  border: 1px solid #e3e3e3;
  border-radius: 8rpx;

  .info-list-row {
    display: flex;
    width: 100%;

    .info-list-label {
      width: 150rpx;
      font-size: 28rpx;
      color: #808080;
    }

    .info-list-value {
      display: flex;
      flex: 1;
      align-items: center;
      width: 0;
      word-break: break-all;
      white-space: pre-line;
    }
  }
}

.craft-row {
  display: flex;
  align-items: center;

  .craft-row-img-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 0;
  }
}

.craft-row-img {
  width: 240rpx;
  height: 240rpx;
}

.form-demandDesc {
  align-items: flex-start !important;

  .text {
    word-break: break-all;
  }
}
.info-row-item {
  padding: 6rpx 0;
  word-break: break-all;

  // border-bottom: 1px solid #f2f2f2;
}

.text {
  word-break: break-all;
  word-wrap: break-word;
}

.flow-btn-fixed {
  width: 100%;
  background-color: white;
  border-top: 1px solid #f2f2f1;
  // position: fixed;
  // bottom: 0;
  // left: 0;
  // right: 0;
}

.btn_group {
  display: flex;
  justify-content: space-between;

  // margin: 0rpx 0 20rpx;
  // border-bottom: 1px solid #f2f2f1;

  .btn {
    display: flex;

    // width: 49%;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    // height: 40px;
    min-height: 40px;
    padding: 10rpx 0;
    font-size: 24rpx;
    color: black;

    // background-color: white !important;
    background-color: #dbecff !important;
    border-left: 1px solid #f7f7f7;
    border-radius: 0 !important;

    // color: white;
    border-radius: 6rpx;

    .btn-icon {
      width: 40rpx;
      height: 40rpx;
      margin-bottom: 8rpx;
    }
  }

  .danger {
    background-color: #f56c6c;
  }

  .primary {
    background-color: #409eff;
  }
}

:deep(.uni-date__x-input) {
  line-height: inherit;
  font-size: 14px;
  color: #999;
}

.blocks {
  display: flex;
  align-items: center;
  margin-top: 32rpx;
  margin: 0 26rpx;
  width: 100%;
  border-bottom: 1px solid #f7f7f7;
  .label {
    // margin-bottom: 20rpx;
    font-size: 14px;
    color: #666;
    min-width: 160rpx;
    // font-weight: bold;
  }

  .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex-wrap: wrap;
    padding: 20rpx;
    min-height: 32rpx;
    // justify-content: space-between;
    :deep(.uni-date__x-input) {
      color: #666;
    }
    .date-picker {
      flex: 1;

      text-align: center;
      background-color: #f7f7f7;
      border-radius: 8rpx;
    }

    .select-box {
      flex: 1;

      // background-color: #f7f7f7;
      border-radius: 8rpx;

      :deep(.select-row) {
        padding: 0;
        background: none;
      }
    }

    input {
      flex: 1;
      height: 33rpx;
      padding: 0 12rpx;
      font-size: 26rpx !important;
      // background-color: #f7f7f7;
      // border: 1rpx solid #f7f7f7;
      border-radius: 8rpx;

      .input-placeholder {
        color: #8a929f;
      }
    }

    .btn {
      flex: 1;
      padding: 16rpx;
      color: #999;
      text-align: center;
      background-color: #f7f7f7;
      border: 1rpx solid #dedede;
      border-radius: 8rpx;

      ~ .btn {
        margin-left: 24rpx;
      }

      &.primary {
        color: #fff;
        background-color: #007aff;
        border-color: #007aff;
      }
    }
  }
}
// :deep(.uni-date__x-input) {
//   color: #333;
// }
:deep(.uni-textarea-textarea) {
  font-size: 14px;
}
</style>
